package com.vcredit.creditcat.web.api;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.config.annotation.Reference;
import com.vcredit.creditcat.api.IMyWalletManager;
import com.vcredit.creditcat.dto.wallet.WalletDrawHandlerResultDto;
import com.vcredit.creditcat.dto.wallet.WalletDrawLogDto;
import com.vcredit.framework.util.JacksonUtil;


@Controller
@RequestMapping("wallet")
public class WalletController {
	
	@Reference(version = "1.0")
	private IMyWalletManager myWalletManager;
	
	@RequestMapping("handlerUploadFile")
	@ResponseBody
	public Map<String,Object> uploadFile(@RequestBody Map<String,String> param) {
		try {
			WalletDrawHandlerResultDto resultDto = myWalletManager.handlerUploadFile(param);
			Map<String,Object> result = JacksonUtil.Json2Map(JacksonUtil.Obj2Json(resultDto));
			return result;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@RequestMapping("drawlog/query")
	@ResponseBody
	public List<WalletDrawLogDto> query(@RequestBody WalletDrawLogDto param) {
		return myWalletManager.queryWalletLog(param);
	}
	
	@RequestMapping("drawlog/update")
	@ResponseBody
	public Boolean update(@RequestBody WalletDrawLogDto param) {
		return myWalletManager.updateWalletDrawStatus(param);
	}
}
